package com.ruoyi.system.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.system.entity.AbdulBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 库存出入库记录实体类
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("inv_inventory_transaction")
@ApiModel("库存出入库记录")
public class InventoryTransaction extends AbdulBaseEntity {

    @TableId(type = IdType.AUTO)
    @ApiModelProperty("自增主键")
    private Integer id;

    @ApiModelProperty("类型：1-入库/2-出库")
    @Excel(name = "类型", readConverterExp = "1=入库,2=出库",sort = 0)
    private Integer type;

    @ApiModelProperty("出入库类型")//绑定表store_business的id
    private Long storeBusinessId;

    @ApiModelProperty("出入库单号(关联出入库表)")//inv_warehousing_entry
    @Excel(name = "出入库单号",sort = 2)
    private Long invWarehousingEntryId;

    @ApiModelProperty("仓库id")//warehouse
    private Long warehouseId;

    @ApiModelProperty("物品名称")
    @Excel(name = "物品名称",sort = 4)
    private String productName;

    @ApiModelProperty("规格")
    @Excel(name = "规格",sort = 6)
    private String specification;

    @ApiModelProperty("类别")
    @Excel(name = "类别",sort = 7)
    private String category;

    @ApiModelProperty("分类")
    @Excel(name = "分类",sort = 8)
    private String classification;

    @ApiModelProperty("单位")
    @Excel(name = "单位",sort = 10)
    private String unit;

    @ApiModelProperty("变动前库存")
    @Excel(name = "变动前库存",sort = 11)
    private Integer beforeQuantity;

    @ApiModelProperty("变动数量")
    @Excel(name = "变动数量",sort = 12)
    private Integer changeQuantity;

    @ApiModelProperty("库存单价")
    @Excel(name = "库存单价",sort = 13)
    private BigDecimal unitPrice;

    @ApiModelProperty("库存总值")
    @Excel(name = "库存总值",sort = 14)
    private BigDecimal totalValue;

    @ApiModelProperty("商品编号")
    @Excel(name = "商品编号",sort = 9)
    private String code;

    @ApiModelProperty("门店商品库存id（关联门店商品库存表")
    private Long productInventoryId;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "变动时间",sort = 5)
    private Date createTime;
    /** 备注 */
    @ApiModelProperty("备注")
    @Excel(name = "备注",sort = 15)
    private String remark;


    //DTo
    @ApiModelProperty("创建开始时间")
    @TableField(exist = false)
    private Date createTimeStart;
    @ApiModelProperty("创建结束时间")
    @TableField(exist = false)
    private Date createTimeEnd;

    @ApiModelProperty("仓库名称")
    @TableField(exist = false)
    @Excel(name = "仓库名称",sort = 3)
    private String warehouseIdDesc;

    @ApiModelProperty("出入库类型")
    @TableField(exist = false)
    @Excel(name = "出入库类型",sort = 1)
    private String storeBusinessIdDesc;
}
